package com.java.dp.strategy;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author lizhilong
 * @create 2019/12/5 17:03
 * @desc  选择出行策略
 */
public class GoToTibet {

    private  static Map<String,Traffic> strategyMap = new HashMap<>();
    static {
        strategyMap.put("小张",new TrainType());
        strategyMap.put("小王",new BikeType());
        strategyMap.put("小李",new WalkType());
    }

    public void chooseTrafficType(String name){
       Traffic traffic = strategyMap.get(name);
       traffic.trafficType(name);
    }
}
